<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateWaimaiShopMappingTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('waimai_shop_mappings', function (Blueprint $table) {
            $table->id();
            $table->unsignedTinyInteger('sourceType')->default(0)->comment('来源 3美团 4饿了么');
            $table->unsignedInteger('shopId')->default(0)->comment('我方店铺id');
            $table->string('thirdShopId', 32)->default('')->comment('三方的店铺id');

            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');

            $table->index('shopId', 'idx_shopId');
            $table->index('thirdShopId', 'idx_thirdShopId');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '外卖平台店铺映射表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('waimai_shop_mappings');
    }
}
